1
|
|
|
module.exports = function (shipit) { |
2
|
|
|
shipit.blTask('initVirtualenv', function() { |
3
|
|
|
return shipit.remote( |
4
|
|
|
"cd " + shipit.releasePath + |
5
|
|
|
" && virtualenv venv -p /usr/bin/python3" + |
6
|
|
|
" && source venv/bin/activate" + |
7
|
|
|
" && pip install --upgrade pip" |
8
|
|
|
); |
9
|
|
|
}); |
10
|
|
|
|
11
|
|
|
shipit.blTask('installVendors', function() { |
12
|
|
|
return shipit.remote( |
13
|
|
|
"cd " + shipit.currentPath + |
14
|
|
|
" && source venv/bin/activate" + |
15
|
|
|
" && pip install --find-links=~/wheels -r requirements.txt --upgrade" |
16
|
|
|
); |
17
|
|
|
}); |
18
|
|
|
|
19
|
|
|
shipit.blTask('upgradeDatabase', function() { |
20
|
|
|
return shipit.remote( |
21
|
|
|
"cd " + shipit.currentPath + |
22
|
|
|
" && source venv/bin/activate" + |
23
|
|
|
" && set -a && source " + shipit.config.deployTo + "/password.conf" + |
24
|
|
|
" && export PYTHONPATH=src" + |
25
|
|
|
" && cd " + shipit.currentPath + |
26
|
|
|
" && python3 src/manage.py db upgrade" |
27
|
|
|
); |
28
|
|
|
}); |
29
|
|
|
|
30
|
|
|
shipit.blTask('install', function() { |
31
|
|
|
if(shipit.config.hasDatabase){ |
32
|
|
|
var tasks = ['installVendors', 'upgradeDatabase', 'restartServer'] |
33
|
|
|
} else { |
34
|
|
|
var tasks = ['installVendors', 'restartServer'] |
|
|
|
|
35
|
|
|
} |
36
|
|
|
shipit.start(tasks, function(err) { |
37
|
|
|
if(!err){ |
38
|
|
|
shipit.log('Install done!'); |
39
|
|
|
} |
40
|
|
|
}) |
41
|
|
|
}); |
42
|
|
|
|
43
|
|
|
shipit.on('updated', function() { |
44
|
|
|
return shipit.start('initVirtualenv'); |
45
|
|
|
}); |
46
|
|
|
}; |
47
|
|
|
|
This check looks for variables that are declared in multiple lines. There may be several reasons for this.
In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.
If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.